import request from '@/utils/request'

export function apiGetList(params, loading) {
  return request({
    url: `/obj/busController/list`,
    method: 'get',
    params,
    loading,
    autoUntie: false,
  })
}

export function apiAdd(data) {
  return request({
    url: '/obj/busController/add',
    method: 'post',
    data: data,
  })
}
export function apiEdit(data) {
  return request({
    url: '/obj/busController/edit',
    method: 'put',
    data: data,
  })
}

export function apiDel(ids) {
  return request({
    url: '/obj/busController/' + ids,
    method: 'delete',
  })
}

export function apiGetlistLinkAttribute(data, loading) {
  return request({
    url: '/obj/busController/listLinkAttribute',
    method: 'post',
    data,
    autoUntie: false,
    loading,
  })
}
export function apiEditlistLinkAttribute(data) {
  return request({
    url: '/obj/busController/editLinkAttribute',
    method: 'put',
    data: data,
  })
}
export function apiDellistLinkAttribute(data) {
  return request({
    url: '/obj/busController/deleteLinkAttribute',
    method: 'post',
    data: data,
  })
}
export function apiAddlistLinkAttribute(data, loading) {
  return request({
    url: '/obj/busController/batchAddLinkAttribute',
    method: 'post',
    data: data,
    loading,
  })
}
export function apiGetlistAttrMeta(params, loading) {
  return request({
    url: '/obj/attributeController/referGrid',
    method: 'get',
    params,
    autoUntie: false,
    loading,
  })
}
export function apiGetEr(id) {
  return request({
    url: '/obj/busController/getEr?id=' + id,
    method: 'get',
    resField: 'obj'
  })
}

export function apiGetLinkMeEr(id) {
  return request({
    url: '/obj/busController/linkMeEr?id=' + id,
    method: 'get',
    resField: 'obj'
  })
}

export function apiGetBusTypeDialogList(params, loading) {
  return request({
    url: `/obj/busController/referGrid`,
    method: 'get',
    params,
    loading,
    autoUntie: false,
  })
}
